<div class="maintop">
	当前位置：编辑商品 > <?=$data['title']?>
	<a href="javascript:;" action="<?=$basepath?>?categoryid=<?=$default_cid?>&categorysubid=<?=$default_scid?>" class="mainFrame button">返回</a>
	<a href="javascript:;" action="<?=$basepath?>_edit?code=<?=$data['code']?>&categoryid=<?=$default_cid?>&categorysubid=<?=$default_scid?>" class="mainFrame button">刷新</a>
</div>
<div id="mainbody">
    <div class="main">
        <ul class="switchs">
            <li id="s1">基本</li>
            <li id="s2" class="c">属性</li>
            <li id="s3" class="c">促销</li>
            <li id="s4" class="c">限购</li>
            <li id="s5" class="c">详情</li>
            <li id="s6" class="c">其它</li>
        </ul>
        <form name="add_save" action="<?=$basepath?>_edit_save" method="POST" target="ajax" func="form_submit">
            <div style="display:none;" class="hiddencontentdiv"><textarea id="hiddencontent" name="hiddencontent"></textarea></div>
            <? $this->display('editor',array(
                'textareaid'=>'content',
                'uploadbutton'=>'uploadbutton',
                'inputid'=>'icon1',
                'loadjsandcss'=>true
            ));
            ?>
            <script type="text/javascript">
                <?php
                $newRow = '';
                for($rowcount=2; $rowcount<=5; $rowcount++){
                    $newRow .= 'editor("#uploadbutton'.$rowcount.'").click(function () {';
                    $newRow .= 'editorname.loadPlugin("image", function () {';
                    $newRow .= 'editorname.plugin.imageDialog({';
                    $newRow .= 'imageUrl: editor("#uploadbutton'.$rowcount.'").val(),';
                    $newRow .= 'clickFn: function (url, title, width, height, border, align) {';
                    $newRow .= 'editor("#icon'.$rowcount.'").val(url);';
                    $newRow .= 'editorname.hideDialog();';
                    $newRow .= '}';
                    $newRow .= '});';
                    $newRow .= '});';
                    $newRow .= '});';
                }
                echo $newRow;
                ?>
            </script>
            <input type="hidden" name="iconiscorp" id="iconiscorp" value="0" />
            <input type="hidden" name="id" value="<?=$data['id']?>" />
            <input type="hidden" name="categoryid" value="<?=$default_cid?>" />
            <input type="hidden" name="categorysubid" value="<?=$default_scid?>" />
		    <div class="info">
                <div id="infos1">
                    <dl><dt>编号</dt><dd><input type="text" name="code" class="int" readonly value="<?=$data['code']?>" style="border:0px;background-color:#FFF;" /></dd></dl>
					<dl><dt>标题</dt><dd><input type="text" name="title" class="wtxt" value="<?=$data['title']?>" /></dd></dl>
                    <dl><dt>标签</dt><dd><input type="text" name="keys" class="wtxt" value="<?=$data['keys']?>" /></dd><dd class="t">搜索关键字以“,”分隔</dd></dl>
                    <dl><dt>图示1</dt><dd><input type="text" name="icon1" id="icon1" class="wtxt" value="<?=$data['icon1']?>" /></dd><dd><input type="button" name="uploadbutton" id="uploadbutton" value="选择" /></dd><dd><input type="button" onClick="window.app.producticoncorp('icon1')" id="markeimagescorp1" value="缩图" /></a></dd></dl>
                    <dl><dt>图示2</dt><dd><input type="text" name="icon2" id="icon2" class="wtxt" value="<?=$data['icon2']?>" /></dd><dd><input type="button" name="uploadbutton2" id="uploadbutton2" value="选择" /></dd><dd><input type="button" onClick="window.app.producticoncorp('icon2')" id="markeimagescorp2" value="缩图" /></a></dd></dl>
                    <dl><dt>图示3</dt><dd><input type="text" name="icon3" id="icon3" class="wtxt" value="<?=$data['icon3']?>" /></dd><dd><input type="button" name="uploadbutton3" id="uploadbutton3" value="选择" /></dd><dd><input type="button" onClick="window.app.producticoncorp('icon3')" id="markeimagescorp3" value="缩图" /></a></dd></dl>
                    <dl><dt>图示4</dt><dd><input type="text" name="icon4" id="icon4" class="wtxt" value="<?=$data['icon4']?>" /></dd><dd><input type="button" name="uploadbutton4" id="uploadbutton4" value="选择" /></dd><dd><input type="button" onClick="window.app.producticoncorp('icon4')" id="markeimagescorp4" value="缩图" /></a></dd></dl>
                    <dl><dt>图示5</dt><dd><input type="text" name="icon5" id="icon5" class="wtxt" value="<?=$data['icon5']?>" /></dd><dd><input type="button" name="uploadbutton5" id="uploadbutton5" value="选择" /></dd><dd><input type="button" onClick="window.app.producticoncorp('icon5')" id="markeimagescorp5" value="缩图" /></a></dd></dl>
                    <dl><dt>推荐</dt><dd><select name="recommend">
                                <option value="0"<?=(intval($data['recommend'])==0?' selected="selected"':'')?>>默认</option>
                                <option value="1"<?=(intval($data['recommend'])==1?' selected="selected"':'')?>>推荐</option>
                            </select></dd></dl>
                    <dl><dt>展示状态</dt><dd><select name="state">
                                <option value="0"<?=(intval($data['state'])==0?' selected="selected"':'')?>>禁用</option>
                                <option value="1"<?=(intval($data['state'])==1?' selected="selected"':'')?>>启用</option>
                            </select></dd><dd class="t">禁用后本商品将不在页面上显示</dd></dl>
                    <dl><dt>评论状态</dt><dd><select name="commentstate">
                                <option value="0"<?=(intval($data['commentstate'])==0?' selected="selected"':'')?>>禁用</option>
                                <option value="1"<?=(intval($data['commentstate'])==1?' selected="selected"':'')?>>启用</option>
                            </select></dd><dd class="t">本商品是否可以用户评论</dd></dl>

                    <dl><dt>排序</dt><dd><input type="number" name="sort" class="int" value="<?=$data['sort']?>" /></dd><dd class="t">按5,4,3,2,1的倒序排序</dd></dl>
                    <dl><dt>销量</dt><dd><input type="number" name="sales" class="int" value="<?=$data['sales']?>" /></dd><dd class="t">当前商品的销量统计</dd></dl>
                </div>
                <div id="infos2" class="hide">
                    <dl><dt>单位</dt><dd><input type="text" name="unit" class="int" value="<?=$data['unit']?>" /> </dd></dl>
                    <dl><dt>重量</dt><dd><input type="text" name="heft" class="int" value="<?=$data['heft']?>" /> </dd><dd> KG</dd></dl>
                    <dl><dt>温馨提示</dt><dd><input type="text" name="reminder" class="wtxt" value="<?=$data['reminder']?>" /></dd></dl>
                </div>
                <div id="infos3" class="hide">
                    <dl><dt>网上售价</dt><dd><input type="text" name="pricenet" class="int" value="<?=$data['pricenet']?>" /></dd><dd class="t">目前网上的销售价格</dd></dl>
                    <dl><dt>当前售价</dt><dd><input type="text" name="price" class="int" value="<?=$data['price']?>" /> </dd><dd class="t">当前销售的优惠价格</dd></dl>
                    <dl><dt>积分售价</dt><dd><input type="text" name="pricescore" class="int" value="<?=$data['pricescore']?>" /> </dd><dd class="t">使用积分来兑换的价格</dd></dl>
                    <dl><dt>赠送积分</dt><dd><input type="number" name="score" class="int" value="<?=$data['score']?>" /> </dd><dd class="t">赠送的积分</dd></dl>
                    <dl><dt>商品库存</dt><dd><input type="number" name="inventory" class="int" value="<?=$data['inventory']?>" /></dd><dd class="t">当前商品的库存量</dd></dl>
                    <dl><dt>促销价格</dt><dd><input type="text" name="pricesales" class="int" value="<?=$data['pricesales']?>" /> </dd><dd class="t">促销有效内的优惠价格 0 为不启用</dd> </dl>
                    <dl><dt>促销时间</dt><dd><input type="text" name="salesfromtime" class="int" value="<?=(intval($data['salesfromtime']) ? date('Y-m-d H:i:s',strtotime($data['salesfromtime'])) : 0 )?>" /> 至 <input type="text" name="salestotime" class="int" value="<?=(intval($data['salestotime']) ? date('Y-m-d H:i:s',strtotime($data['salestotime'])) : 0 )?>" /> </dd><dd class="t">为 0 时不启用</dd> </dl>
                </div>
                <div id="infos4" class="hide">
                    <dl><dt>最低购买</dt><dd><input type="number" name="minnum" class="int" value="<?=$data['minnum']?>" /></dd><dd class="t">最小购买数量</dd></dl>
                    <dl><dt>最多购买</dt><dd><input type="number" name="maxnum" class="int" value="<?=$data['maxnum']?>" /></dd><dd class="t">最大购买数量</dd></dl>
                    <dl><dt>会员等级</dt>
                        <dd><select name="buyforvip">
                                <? foreach($uservip as $k=>$v){ ?>
                                    <option value="<?=$k?>"<?=(intval($data['buyforvip'])==$k)?' selected="selected"':''?>><?=$v?></option>
                                <? } ?>
                            </select>
                        </dd><dd class="t">只有在这个等级以上的会员才可以购买本商品</dd></dl>
                    <dl><dt>代理等级</dt>
                        <dd><select name="buyforagent">
                                <? foreach($agent as $k=>$v){ ?>
                                    <option value="<?=$k?>"<?=(intval($data['buyforagent'])==$k)?' selected="selected"':''?>><?=$v?></option>
                                <? } ?>
                            </select>
                        </dd><dd class="t">只有在这个等级以上的代理才可以购买本商品</dd></dl>
                </div>
                <div id="infos5" class="hide">
                    <textarea name="content" id="content" class="wtxt" style="width:99.8%;height:400px;" ><?=$data['content']?></textarea>
                </div>
                <div id="infos6" class="hide">
                    <dl><dt>商品原址</dt><dd><input type="text" name="website" class="wtxt" value="<?=$data['website']?>" /></dd><dd class="t">商品原地址</dd></dl>
                </div>
                <div class="btndiv">
                     <input type="submit" value="确认" class="btnbig" />
                     <a href="javascript:;" action="<?=$basepath?>?categoryid=<?=$default_cid?>&categorysubid=<?=$default_scid?>" class="mainFrame btnbig">返回</a>
                </div>
		    </div>

        </form>
	</div>
</div>
<script type="text/javascript">
    $("input[name=price]").on("input",function () {
       $("input[name=score]").val(parseInt($(this).val()));
    });
</script>
